package com.dc.chat.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dc.chat.app.service.mp.PictureService;
import com.dc.chat.dto.PictureQueryReq;
import com.dc.chat.entity.dao.Picture;
import com.dc.chat.entity.to.ResponseBean;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping("/pic")
public class PictureController {
    @Resource
    private PictureService pictureService;
    @PostMapping("/getActionPictures")
    public ResponseBean<IPage<Picture>> getPicturesByPage(@RequestBody PictureQueryReq req){
        long current = 1;
        long size = 10;
        if (req.getCurrent()>0){
            current=req.getCurrent();
        }
        if (req.getSize()>0){
            size=req.getSize();
        }
        IPage<Picture> pages = pictureService.pages(current, size);
        return ResponseBean.success("success",pages);
    }
}
